﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Data;

namespace GuiSearcher.Converters {
    public class DateToStringConverter : IValueConverter {
        public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) {
            if (!(value is DateTime) || ((DateTime)value) == DateTime.MinValue)
                return string.Empty;
            return ((DateTime)value).ToString();
        }

        public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) {
            if (value == null)
                return DateTime.MinValue;
            return value;
        }
    }
}
